<template>
  <div class="person">
    <h2>姓名:{{name}}</h2>
    <h2>年龄:{{age}}</h2>
    <h2>电话:{{tel}}</h2>
    <h2>地址:{{address}}</h2>
    <button @click="changeName">修改姓名</button>
    <button @click="changeAge">修改年龄</button>
    <button @click="AddAge">增加年龄</button>
    <input type="text" v-model="newusername" placeholder="请输入新的姓名"></input>
    <!--绑定属性-->
  </div>
</template>
<script lang="ts" setup name="Person">
import {ref} from "vue";

let name = ref('张三')
let age = ref(18)
let tel = '13888888888'
let address = '北京昌平区宏福苑·宏福科技园'
let newusername = ref('')
//方法
//修改姓名
function changeName(){
  name.value = newusername.value
}
//修改年龄
function changeAge(){
  age.value = 19
}
//增加年龄
function AddAge(){
  age.value = age.value+1
}
</script>
<style>
.person{
  background-color: aqua;
  box-shadow: 0 0 10px;
  border-radius: 10px;
  padding: 20px;
}
button{
  margin: 0 5px;
}
</style>